package com.yuqiangz.boot.config;

import com.yuqiangz.boot.bean.Car;
import com.yuqiangz.boot.bean.Pet;
import com.yuqiangz.boot.bean.User;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.ImportResource;

/**
 * @author 赵雨强
 * @create 2021/7/23 20:33
 * @description 配置类
 */
@Configuration
@EnableConfigurationProperties(Car.class)
@ImportResource(value = {"classpath:beans.xml"})
public class MyConfig {

    @Bean
    public User user01(){
        User user = new User();
        user.setName("zhangsan");
        user.setAge(16);
        return user;
    }

    @Bean
    public Pet tomcatPet(){
        Pet pet = new Pet();
        pet.setName("tomcat");
        return pet;
    }

}
